package com.zhanghe.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zhanghe.model.ImageFile;
@Mapper
public interface ImageFileMapper {
	@Select("SELECT * FROM ImageFile WHERE file_name = #{name}")
	ImageFile findByName(@Param("name") String name);
   // @Insert("INSERT INTO ImageFile(file_name, file_path, file_type, folder) VALUES(#{imageFile.file_name}, #{imageFile.file_path} , #{imageFile.file_type}, #{imageFile.folder})")
	 @Insert("INSERT INTO ImageFile(file_name, file_path, file_type, folder) VALUES(#{imageFile.fileName}, #{imageFile.filePath} , #{imageFile.filetype}, #{imageFile.folder})")
	 @Options(useGeneratedKeys = true, keyProperty = "imageFile.id")
   // int insert(@Param("file_name") String file_name, @Param("file_path") String file_path, @Param("file_type") Integer file_type, @Param("folder") String folder);
    void insert(@Param("imageFile")ImageFile imageFile);
}
